# 导入必要的库
import turtle
import time
import random

# 展示中秋节诗词
def display_poem():
    poem = [
        "明月几时有？把酒问青天。",
        "不知天上宫阙，今夕是何年。",
        "我欲乘风归去，又恐琼楼玉宇，高处不胜寒。",
        "起舞弄清影，何似在人间。",
        "转朱阁，低绮户，照无眠。",
        "不应有恨，何事长向别时圆？",
        "人有悲欢离合，月有阴晴圆缺，此事古难全。",
        "但愿人长久，千里共婵娟。"
    ]
    for line in poem:
        print(line)
        time.sleep(1)  # 暂停一秒，逐行显示

# 互动式灯谜游戏
def guess_the_riddle():
    print("\n猜灯谜时间：")
    riddles = [
        {"question": "举头望明月", "answer": "抬头"},
        {"question": "中秋佳节大团圆", "answer": "中秋节快乐"},
        {"question": "十五的月亮", "answer": "正大光明"}
    ]
    riddle = random.choice(riddles)
    answer = input(f"猜一猜：{riddle['question']}（输入'答案'查看提示）: ")
    if answer == riddle["answer"]:
        print("恭喜你，答对了！")
    else:
        print(f"答案错误，正确答案是：{riddle['answer']}")
    input("按任意键继续...")

# 庆祝中秋节
def celebrate_mid_autumn_festival():
    print("🌕 中秋节快乐 🌕")
    display_poem()
    guess_the_riddle()
    learn_more = input("想要了解更多关于中秋节的信息吗？(yes/no): ")
    if learn_more.lower() == "yes":
        print("中秋节，又称月夕、秋节、仲秋节、八月节、八月会、追月节、玩月节、拜月节、女儿节或团圆节，是中国传统文化节日。")
        print("中秋节始于唐朝初年，盛行于宋朝，至明清时，已成为与春节齐名的中国传统节日之一。")
        print("中秋节自古便有祭月、赏月、拜月、吃月饼、赏桂花、饮桂花酒等习俗，流传至今，经久不息。")
        print("中秋节以月之圆兆人之团圆，为寄托思念故乡，思念亲人之情，祈盼丰收、幸福，成为丰富多彩、弥足珍贵的文化遗产。")
    else:
        print("好的，祝您中秋节快乐，与家人共度美好时光！")

# 绘制中秋明月
def draw_moon():
    screen = turtle.Screen()
    screen.bgcolor("black")
    moon = turtle.Turtle()
    moon.color("yellow")
    moon.begin_fill()
    moon.circle(100)
    moon.end_fill()
    moon.goto(-50, 0)
    moon.pendown()
    moon.pencolor("white")
    moon.pensize(2)
    for _ in range(2):
        moon.circle(100, 180)
        moon.circle(30, 180)
        moon.setheading(180)
        moon.circle(100, 180)
        moon.circle(-30, 180)
        moon.setheading(0)
    moon.hideturtle()
    screen.mainloop()

# 程序入口
def main():
    celebrate_mid_autumn_festival()
    draw_moon()

if __name__ == "__main__":
    main()
